package com.me.learnspring.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.*;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import java.util.List;

@Entity
@Table(name = "category")
@Data
@EqualsAndHashCode(callSuper = true)
@AllArgsConstructor
@NoArgsConstructor
@ToString(callSuper = true)
@Builder
public class Category extends BaseEntity {
	private String name;
	
	@OneToMany(mappedBy = "category")
	@JsonIgnore
	private List<Drink> drinks;
	
	@Override
	public String toString() {
		return "Category{" +
			"name='" + name + '\'' +
			"} " + super.toString();
	}
}
